package com.yhg.qxmall.product.front;

import com.yhg.common.utils.R;
import com.yhg.qxmall.product.service.SkuInfoService;
import com.yhg.qxmall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
 * @author 凌月青缃
 * @date 2020/12/19
 */
@RestController
@RequestMapping("front/item")
public class FrontItemController {

    @Autowired
    SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public R skuItem(@PathVariable("skuId") Long skuId) throws ExecutionException, InterruptedException {
        System.out.println("准备查询"+skuId+"详情");
        SkuItemVo vo = skuInfoService.item(skuId);
        return R.ok().put("data",vo);
    }

}
